1. Field of the Invention
The present invention relates to a processing system and method for protocol offload. More particularly, the present invention relates to a system and method for recognizing offloaded packets.
2. Description of the Related Art
Referring to FIG. 1, it shows a conventional protocol offload processing system 10 with an embedded CPU. The conventional protocol offload processing system 10 comprises a CPU 11, a hardware acceleration logic 12, a packet buffer 13 and a memory 14. The hardware acceleration logic 12 is bridged to a media access control module of a network 15, a host interface of a host 16 and an embedded CPU interface. When receiving a packet, the hardware acceleration logic 12 first temporarily stores the packet in the packet buffer 13 and processes the packet based on the packet recognition result. If the packet is recognized as a non-offloaded packet, the packet is transmitted to the host 16 to proceed subsequent processes performed by conventional protocol software. If the packet is recognized as an offloaded packet, after the protocol offload processing system 10 finishes the protocol process, the payload of the packet is transmitted to the host and contacts the original socket interface through an exclusive interface, such that an upper layer application program achieves a correct data stream.
A common packet can be recognized by a connection identification (CID) of each protocol. In an embodiment of the TCP/IP protocol, the CID is constituted by four sorts of connection information, namely, a source IP address, a source TCP port, a destination IP address and a destination TCP port.
The CID of each protocol is usually too redundant, for example, in an embodiment of the TCP/IP protocol, the total length of the CID is 96 bits. As for the protocol offload processing system supporting the offload of n connections, the cost is high if a piece of hardware is directly used to compare n groups of 96 bits. Therefore, generally, a specific hash function is utilized to map the CID of a packet from the 96-bit space to a smaller space, and then determine whether the packet is an off-loaded one according to a hash table corresponding to the smaller space. As the connection protocol information hit each other when being mapped from a large space to a smaller space, each entry of the hash table usually corresponds to a linked-list to connect the hit connection protocol information.
In a word, during a common recognition process, an entry corresponding to the CID in the hash table is first calculated by the hash function. Then, the CID of each packet is compared with the CID of the offloaded connection one by one in the linked-list corresponding to the entry. If there is any CID of the offloaded connections in the linked-list equal to that of a received packet, the received packet is an offloaded packet; conversely, if there is no CID of the offloaded connections in the linked-list equal to that of the received packet, the received packet is a non-offloaded packet.
During a common recognition process, the recognition result directly determines whether the received packet is an offloaded packet, and the process that can directly determine whether the packet is an offloaded one is referred to as positive recognition. In positive recognition, the calculation of the hash function is suitable to be accelerated by hardware, and the search of the linked-list corresponding to the hash table is suitable to be executed by an embedded CPU. In order to reduce the time for searching the linked-list, the selection of the hash function becomes very important. However, the effect of the hash function depends on the region of the connections. For example, in an embodiment of the TCP/IP, different kinds of IP addresses are allocated to different regions, or called domains. Therefore, if the hash function is used for widely distributed domains, for example, in a WAN, it is difficult to forecast how the hash function will improve the recognition speed of a packet.
Therefore, to solve the above problems, it is necessary to provide system and method for recognizing offloaded packets.